package config

import (
	"fmt"
	"github.com/spf13/viper"
)

type Config struct {
	Mysql struct {
		User     string
		Password string
		Host     string
		Port     int
		Data     string
	}
}

var Add Config

func Init() {
	viper.SetConfigFile("./config/dev.yaml")
	if err := viper.ReadInConfig(); err != nil {
		fmt.Println("配置文件读取失败")
	}
	if err := viper.Unmarshal(&Add); err != nil {
		fmt.Println("配置文件解析失败")
	}
	fmt.Println(Add)
}
